﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using KPIS.GERP.GHRMS.BLL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.MODEL;
using System.Globalization;

namespace KPIS.GERP.GHRMS.APP.App_UI.UserControls
{
    public partial class RC_BackManageOld : System.Web.UI.UserControl
    {

        private object _dataItem = null;

        protected bool IsUserControlPostBack
        {
            get
            {
                return this.ViewState["IsUserControlPostBack"] != null;
            }
        }



        public string formatDateThai(string value)
        {

            //08/04/2553

            int pos = value.IndexOf("0:00:00");
            if (pos > 1)
            {
                value = value.Replace("00:00:00", "");
                value = value.Replace("0:00:00", "");
            }


            string tmp = null;
            string[] tmp2 = null;
            tmp2 = value.Split('/');
            tmp = tmp2[1] + "/" + tmp2[0] + "/" + Convert.ToString(int.Parse(tmp2[2]));

            return tmp;
        }




        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);

            if (!IsUserControlPostBack)
            {


  
                bindMovmentCombo();

                bindPosTypeCombo();
                bindClasscombo();
                bindJobSiteCombo();

                bindOldClasscombo();                
                bindOldPosTypeCombo();

                this.ViewState.Add("IsUserControlPostBack", true);

            }

            if (DataItem != null)
            {
                

                if (!(DataItem is Telerik.Web.UI.GridInsertionObject))
                {



                    bindMovmentCombo();

                    bindPosTypeCombo();
                    bindClasscombo();
                    bindJobSiteCombo();

                    bindOldClasscombo();
                    bindOldPosTypeCombo();

                    btnFindTempEmployee.Visible = false;

                    lblDtlsSeq.Text = DataBinder.Eval(DataItem, "cmd_dtls_seq").ToString();
                    lblEmpSeq.Text = DataBinder.Eval(DataItem, "emp_seq").ToString();

                    RC_BackManageOldBLL obj = new RC_BackManageOldBLL();
                    DataTable dt;
                    dt = obj.SelectEmpByID(int.Parse(lblEmpSeq.Text));
                    
                    //// ชื่อ  สกุล  //////
                    txtEmployee.Text = dt.Rows[0]["full_name"].ToString();
                    movmentCombo.SelectedValue = DataBinder.Eval(DataItem, "move_seq").ToString();


                    /////////////////




                    //  วุฒิการศึกษา //////////

                    RC_BackManageOldBLL obj2 = new RC_BackManageOldBLL();

                    BindComboEdu();
                    ComboTmpEdu.SelectedValue = DataBinder.Eval(DataItem, "edu_his_seq").ToString();
                    int edu_qual_seq = int.Parse(ComboTmpEdu.SelectedValue);
                    dt = obj2.BindTxtMajor(edu_qual_seq);

                    if (dt.Rows.Count > 0)
                    {
                        lblMajor.Text = dt.Rows[0]["edu_major_name"].ToString();
                        lblInstitutes.Text = dt.Rows[0]["edu_ins_name"].ToString();
                    }



                    ////////////////////////


                   txtEmployee.Text =   DataBinder.Eval(DataItem, "full_name").ToString();    

                    // วุฒิการศึกษา

                 //  ComboTmpEdu.SelectedValue = DataBinder.Eval(DataItem, "tmp_edu_seq").ToString();    


                   // ตำแหน่งและส่วนราชการเดิม

           
                   txtOldPosition.Text = DataBinder.Eval(DataItem, "old_pos_name").ToString();
                   oldPosTypeCombo.SelectedValue = DataBinder.Eval(DataItem, "old_pos_type_seq").ToString();
                

                   oldClassCombo.SelectedValue = DataBinder.Eval(DataItem, "old_class_seq").ToString();
                   txtOldJobsiteName.Text = DataBinder.Eval(DataItem, "old_job_site_name").ToString();
                   txtOldSalary.Text = DataBinder.Eval(DataItem, "old_salary").ToString();


                   //ตำแหน่งและส่วนราชการที่รับโอน 

                   
                   string strDate;
                   txtPosition.Text = DataBinder.Eval(DataItem, "new_pos_name").ToString();
                   txtPosRef.Text = DataBinder.Eval(DataItem, "new_pos_ref").ToString();
                   
                    posTypeCombo.SelectedValue = DataBinder.Eval(DataItem, "new_pos_seq").ToString();
                    classCombo.SelectedValue = DataBinder.Eval(DataItem, "new_class_seq").ToString();
                   jobSiteCombo.SelectedValue = DataBinder.Eval(DataItem, "new_job_site_seq").ToString();
                   txtSalary.Text = DataBinder.Eval(DataItem, "new_salary").ToString();

                   txtRemarks.Text = DataBinder.Eval(DataItem, "remarks").ToString();
                   strDate = ((DateTime)DataBinder.Eval(DataItem, "start_date")).ToString("dd/MM/yyyy", new CultureInfo("th-TH"));
                   txtStartDate.SetValue(strDate);



                   lblPosSeq.Text = DataBinder.Eval(DataItem, "new_pos_seq").ToString();
                   txtRemarks2.Text  = DataBinder.Eval(DataItem, "remarks2").ToString();

                   string exec, old_exec;

                   exec = DataBinder.Eval(DataItem, "new_exec_seq").ToString();
                   old_exec = DataBinder.Eval(DataItem, "old_exec_seq").ToString();
                    BindExec(int.Parse(exec));
                    BindOldExec(int.Parse(old_exec));   

                }


                btnUpdate.Visible = !(DataItem is Telerik.Web.UI.GridInsertionObject);
                btnAddnew.Visible = (DataItem is Telerik.Web.UI.GridInsertionObject);
            }


        }



        private void BindComboEdu()
        {
            DataTable dt;
            RC_BackManageOldBLL obj = new RC_BackManageOldBLL();
             

 
            dt = obj.SelectComboEdu(int.Parse(lblEmpSeq.Text));

            ComboTmpEdu.DataValueField = "edu_qual_seq";
            ComboTmpEdu.DataTextField = "edu_qual_name";
            ComboTmpEdu.DataSource = dt;
            ComboTmpEdu.DataBind();



        }

        private void bindClasscombo()
        {

            DataTable dt;
            MoveCommandBLL obj = new MoveCommandBLL();

            dt = obj.SelectClasscombo();

            classCombo.DataValueField = "class_seq";
            classCombo.DataTextField = "class_name";
            classCombo.DataSource = dt;
            classCombo.DataBind();
        }

        private void bindOldClasscombo()
        {

            DataTable dt;
            MoveCommandBLL obj = new MoveCommandBLL();

            dt = obj.SelectClasscombo();

            oldClassCombo.DataValueField = "class_seq";
            oldClassCombo.DataTextField = "class_name";
            oldClassCombo.DataSource = dt;
            oldClassCombo.DataBind();
        }

        private void bindJobSiteCombo()
        {
            DataTable dt;
            MoveCommandBLL obj = new MoveCommandBLL();

            dt = obj.SelecteJobsiteCombo();
            jobSiteCombo.DataValueField = "job_site_seq";
            jobSiteCombo.DataTextField = "job_site_name";
            jobSiteCombo.DataSource = dt;
            jobSiteCombo.DataBind();
        }
                
        private void bindMovmentCombo()
        {
            DataTable dt;
            MoveCommandBLL obj = new MoveCommandBLL();

            dt = obj.SelectMovmentCombo();

            movmentCombo.DataValueField = "move_seq";
            movmentCombo.DataTextField = "move_name";
            movmentCombo.DataSource = dt;
            movmentCombo.DataBind();
        }
        
        private void bindOldPosTypeCombo()
        {
            DataTable dt;
            MoveCommandBLL obj = new MoveCommandBLL();

            dt = obj.SelectePosTypeCombo();

            oldPosTypeCombo.DataValueField = "pos_type_seq";
            oldPosTypeCombo.DataTextField = "pos_type_name";
            oldPosTypeCombo.DataSource = dt;
            oldPosTypeCombo.DataBind();
        }

        private void bindPosTypeCombo()
        {
            DataTable dt;
            MoveCommandBLL obj = new MoveCommandBLL();

            dt = obj.SelectePosTypeCombo();

            posTypeCombo.DataValueField = "pos_type_seq";
            posTypeCombo.DataTextField = "pos_type_name";
            posTypeCombo.DataSource = dt;
            posTypeCombo.DataBind();
        }


        public object DataItem
        {
            get
            {
                return this._dataItem;
            }
            set
            {
                this._dataItem = value;
            }
        }

        protected void btnAddnew_Click(object sender, EventArgs e)
        {
          

            string  start_date,curr_class_date;//ตั้งแต่วันที่
            int cmd_seq, tmp_emp_seq, emp_seq, new_pos_seq;//รหัสคำสั่ง,รหัส tmp บุคลากร,รหัสตำแหน่ง
            string new_pos_ref,old_pos_ref, new_pos_name;//เลขที่ตำแหน่ง,ชื่อตำแหน่ง
            int new_class_seq, new_job_site_seq;//รหัสระดับ,รหัสหน่วยงาน
            string new_job_site_name;//ชื่อหน่วยงาน

            int tmp_edu_seq, edu_his_seq;// seq วุฒิการศึกษาที่บรรจุ
            string ent_no,ent_pos_name;//สอบแข่งขันได้ลำดับที่,ตำแหน่งที่สอบแข่งขันได้
            int ent_pos_type_seq, ent_class_seq;//ประภทตำแหน่งที่สอบแข่งขันได้,ระดับตำแหน่งที่สอบแข่งขันได้
            string ent_job_site_name,ent_date;//ตามประกาศผลสอบของ,ลงวันที่

            int old_pos_type_seq,old_class_seq; //ประเภทตำแหน่งเดิม,ระดับตำแหน่งเดิม
            string old_job_site_name, old_pos_name;//สังกัดเดิม,ตำแหน่งเดิม
            double old_salary, new_salary, new_salary_extra; //เงินเดือนเดิม ,เงินเดือน
                        
            int move_seq,pos_type_seq;//ประเภทการเคลื่อนไหว,ตำแหน่งประเภท
            string remarks,remarks2;//หมายเหตุ
            int created_by,new_pos_type_seq;

            // exec_pos
            int old_exec_pos_seq, exec_pos_seq;



            cmd_seq = int.Parse(Session["cmd_seq"].ToString())   ;
            move_seq = int.Parse(movmentCombo.SelectedValue);  

            // วุฒิการศึกษา
            tmp_edu_seq  = int.Parse(ComboTmpEdu.SelectedValue);   


            // ตำแหน่งและส่วนราชการเดิม

            old_pos_name = txtOldPosition.Text;
           
            old_pos_type_seq = int.Parse(oldPosTypeCombo.SelectedValue);
            old_class_seq = int.Parse(oldClassCombo.SelectedValue);
            old_job_site_name = txtOldJobsiteName.Text;
            old_salary = Convert.ToDouble(txtOldSalary.Text);
            new_salary = Convert.ToDouble(txtSalary.Text);
            old_exec_pos_seq = int.Parse(lblOldPosExec.Text);
            exec_pos_seq = int.Parse(lblExec.Text);           
              
            //ตำแหน่งและส่วนราชการที่รับโอน 

            new_pos_seq = int.Parse(lblPosSeq.Text);  
            new_pos_name = txtPosition.Text;
            new_pos_ref = txtPosRef.Text;  
            new_class_seq = int.Parse(classCombo.SelectedValue);
            new_job_site_seq = int.Parse(jobSiteCombo.SelectedValue);
            new_job_site_name = jobSiteCombo.Text;
            start_date = txtStartDate.GetStringValue();
            remarks = txtRemarks.Text;
            remarks2 = txtRemarks2.Text;  
            new_pos_type_seq = int.Parse(posTypeCombo.SelectedValue);



            RC_BackManageOldBLL obj = new RC_BackManageOldBLL();

            obj.insert(cmd_seq, int.Parse(lblEmpSeq.Text), move_seq, tmp_edu_seq, old_pos_name, old_pos_type_seq,
                old_class_seq, old_job_site_name, old_salary, new_salary, new_pos_name, new_pos_ref, new_class_seq,
                new_job_site_seq, new_job_site_name, start_date, new_pos_type_seq, remarks, 1,old_exec_pos_seq,exec_pos_seq,remarks2);    
       
                     






        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {

        }

        protected void btnUpdate_Click(object sender, EventArgs e)
        {
                     


            string start_date,curr_class_date;//ตั้งแต่วันที่
            int cmd_seq, tmp_emp_seq, emp_seq, new_pos_seq;//รหัสคำสั่ง,รหัส tmp บุคลากร,รหัสตำแหน่ง
            string new_pos_ref, old_pos_ref, new_pos_name;//เลขที่ตำแหน่ง,ชื่อตำแหน่ง
            int new_class_seq, new_job_site_seq;//รหัสระดับ,รหัสหน่วยงาน
            string new_job_site_name;//ชื่อหน่วยงาน

            int tmp_edu_seq, edu_his_seq;// seq วุฒิการศึกษาที่บรรจุ
            string ent_no, ent_pos_name;//สอบแข่งขันได้ลำดับที่,ตำแหน่งที่สอบแข่งขันได้
            int ent_pos_type_seq, ent_class_seq;//ประภทตำแหน่งที่สอบแข่งขันได้,ระดับตำแหน่งที่สอบแข่งขันได้
            string ent_job_site_name, ent_date;//ตามประกาศผลสอบของ,ลงวันที่

            int old_pos_type_seq, old_class_seq; //ประเภทตำแหน่งเดิม,ระดับตำแหน่งเดิม
            string old_job_site_name, old_pos_name;//สังกัดเดิม,ตำแหน่งเดิม
            double old_salary, new_salary, new_salary_extra; //เงินเดือนเดิม ,เงินเดือน

            int move_seq, pos_type_seq;//ประเภทการเคลื่อนไหว,ตำแหน่งประเภท
            string remarks,remarks2;//หมายเหตุ
            int created_by, new_pos_type_seq;
            int old_exec_seq,new_exec_seq;


            cmd_seq = int.Parse(Session["cmd_seq"].ToString());
            move_seq = int.Parse(movmentCombo.SelectedValue);

            // วุฒิการศึกษา
            tmp_edu_seq  = int.Parse(ComboTmpEdu.SelectedValue);


            // ตำแหน่งและส่วนราชการเดิม

            old_pos_name = txtOldPosition.Text;
    
            old_pos_type_seq = int.Parse(oldPosTypeCombo.SelectedValue);
            old_class_seq = int.Parse(oldClassCombo.SelectedValue);
            old_job_site_name = txtOldJobsiteName.Text;
            old_salary = Convert.ToDouble(txtOldSalary.Text);
            new_salary = Convert.ToDouble(txtSalary.Text);


            //ตำแหน่งและส่วนราชการที่รับโอน 

            new_pos_seq = int.Parse(classCombo.SelectedValue);
            new_pos_name = txtPosition.Text;
        
            new_class_seq = int.Parse(classCombo.SelectedValue);
            new_job_site_seq = int.Parse(jobSiteCombo.SelectedValue);
            new_job_site_name = jobSiteCombo.Text;
            start_date = txtStartDate.GetStringValue();
            remarks = txtRemarks.Text;
            remarks2 = txtRemarks2.Text;  
            new_pos_type_seq = int.Parse(posTypeCombo.SelectedValue);
    
            new_pos_ref = txtPosRef.Text;  

            remarks2 = txtRemarks2.Text;
            old_exec_seq = int.Parse(lblOldPosExec.Text);
            new_exec_seq = int.Parse(lblExec.Text);




            RC_BackManageOldBLL obj = new RC_BackManageOldBLL();


            obj.Update(int.Parse(lblDtlsSeq.Text), move_seq, tmp_edu_seq, old_pos_name, old_pos_type_seq,
            old_class_seq, old_job_site_name, old_salary, new_salary, new_pos_name, new_pos_ref, new_class_seq,
            new_job_site_seq, new_job_site_name, start_date, new_pos_type_seq, remarks, 1,old_exec_seq ,new_exec_seq,remarks2  );     
      
        }

        protected void movmentCombo_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {

        }

        protected void oldPosTypeCombo_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {

        }

        protected void posTypeCombo_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {

        }

        protected void jobSiteCombo_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {

        }

        protected void classCombo_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {

        }
       
        protected void txtSalary_TextChanged(object sender, EventArgs e)
        {

        }

        protected void txtStartDate_TextChanged(object sender, EventArgs e)
        {

        }

        protected void txtOldJobsiteName_TextChanged(object sender, EventArgs e)
        {

        }

        protected void txtOldPosition_TextChanged(object sender, EventArgs e)
        {

        }

        protected void txtOldSalary_TextChanged(object sender, EventArgs e)
        {

        }

        protected void btnFindTempEmployee_Load(object sender, EventArgs e)
        {
            if (DataItem is Telerik.Web.UI.GridInsertionObject)
            {
                btnFindTempEmployee.Attributes.Add("OnClick", "LinkMDdetail(" + HideEmployee.ClientID + "," + "'Forms/DialogRC_Emp.aspx','../frmIframe.html',700,500)");
            }



        }

        protected void oldClassCombo_SelectedIndexChanged1(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {

        }




        private EmployeeInfo empInfo;
        private IEmployeeBLL empBLL = new EmployeeBLL();

        protected void btnFindTempEmployee_Click1(object sender, ImageClickEventArgs e)
        {



            //txtEmployee.Text = "";
           


            //string st = HideEmployee.Value;
            //if (st == "")
            //    return;

            //lblEmpSeq.Text = st;

            //RC_TransferOfficialPlusBLL obj = new RC_TransferOfficialPlusBLL();

            //int cmd_seq = int.Parse(Session["cmd_seq"].ToString());
            //if (obj.chkDup(cmd_seq, int.Parse(st)) == true)
            //{
            //    lblWarningDup.Visible = true;
            //    lblWarningDup.Text = "มีรายชื่อนี้อยู่ในระบบแล้ว";
            //    return;

            //}
            //else
            //{
            //    lblWarningDup.Visible = false;

            //}

            //DataTable dt;

            //RC_TransferBLL obj2 = new RC_TransferBLL(); 
            //dt = obj2.SelectTmpEmpByID(int.Parse(st));
            //txtEmployee.Text = dt.Rows[0]["full_name"].ToString();

            //BindComboTmpEdu();


                txtEmployee.Text = "";
           
            
            string st = HideEmployee.Value;
            if (st == "")
                return;
            
            lblEmpSeq.Text = st;





            IList<EmployeeInfo> empList = empBLL.ListEmployees(st.ToString());

            if (empList.Count > 0)
            {

                empInfo = empList[0];
                RC_PromoteOfficialBLL obj = new RC_PromoteOfficialBLL();

                int cmd_seq = int.Parse(Session["cmd_seq"].ToString());
                if (obj.chkDup(cmd_seq, int.Parse(st)) == true)
                {
                    lblWarningDup.Visible = true;
                    lblWarningDup.Text = "มีรายชื่อนี้อยู่ในระบบแล้ว";
                    return;

                }
                else
                {
                    lblWarningDup.Visible = false;

                }

                DataTable dt;
                dt = obj.SelectEmpByID(int.Parse(st));
                txtEmployee.Text = dt.Rows[0]["full_name"].ToString();


                BindComboEdu();



                txtOldJobsiteName.Text = empInfo.WorkingJobSite.Name;
                txtOldPosition.Text = empInfo.Position.Name;
                txtOldSalary.Text = empInfo.Salary.ToString();
                //  txtOldPosRef.Text = empInfo.Position.RefNo;

                oldClassCombo.SelectedValue = empInfo.Class.Sequence.ToString();
                oldPosTypeCombo.SelectedValue = empInfo.Position.PositionType.Sequence.ToString();
            }
            
        }



        protected void ComboTmpEdu_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {

            int edu_qual_seq;
            edu_qual_seq = int.Parse(ComboTmpEdu.SelectedValue);
            DataTable dt;
            RC_BackManageOldBLL obj = new RC_BackManageOldBLL();

           
            dt = obj.BindTxtMajor(edu_qual_seq);

            lblMajor.Text = dt.Rows[0]["edu_major_name"].ToString();
            lblInstitutes.Text = dt.Rows[0]["edu_ins_name"].ToString();   
        }

        protected void txtOldPosition_TextChanged1(object sender, EventArgs e)
        {

        }

     
        protected void DetailPanel_Load(object sender, EventArgs e)
        {

        }

        protected void btnFindOldPos_Click(object sender, ImageClickEventArgs e)
        {


            string st = HideOldPos.Value;
            if (st == "")
                return;

         //   txtOldPosition.Text = st;

            RC_TransferBLL obj = new RC_TransferBLL();
            DataTable dt;
            dt = obj.BindPositionType(int.Parse(st));

            string idx;
            idx = dt.Rows[0]["pos_type_seq"].ToString();

            oldPosTypeCombo.SelectedValue = idx;

            txtOldPosition.Text = dt.Rows[0]["field_pos_line"].ToString();

        }

        protected void btnFindOldPos_Load(object sender, EventArgs e)
        {

            //if (DataItem is Telerik.Web.UI.GridInsertionObject)
            //{
                btnFindOldPos.Attributes.Add("OnClick", "LinkMDdetail(" + HideOldPos.ClientID + "," + "'Forms/DialogRC_OldPos.aspx','../frmIframe.html',700,500)");
            //}


        }

        protected void btnFindPos_Click(object sender, ImageClickEventArgs e)
        {

            string st = HideOldPos.Value;
            if (st == "")
                return;


            RC_TransferBLL obj = new RC_TransferBLL();

            DataTable dt;


            //dt = obj.BindPosition(int.Parse(st));
 
   
            //if(dt.Rows.Count > 0) 
            //{


            //    lblPosSeq.Text  = dt.Rows[0]["pos_seq"].ToString();  
            //    txtPosition.Text = dt.Rows[0]["pos_name"].ToString();
            //    posTypeCombo.SelectedValue = dt.Rows[0]["pos_type_seq"].ToString();
            //    jobSiteCombo.SelectedValue = dt.Rows[0]["job_site_seq"].ToString();
            //    txtPosRef.Text = dt.Rows[0]["pos_ref"].ToString(); 
            //}


        }

        protected void btnFindPos_Load(object sender, EventArgs e)
        {

            //if (DataItem is Telerik.Web.UI.GridInsertionObject)
            //{
                btnFindPos.Attributes.Add("OnClick", "LinkMDdetail(" + HideOldPos.ClientID + "," + "'Forms/DialogRC_Pos.aspx','../frmIframe.html',700,500)");
            //}


        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnFindOldExec_Load(object sender, EventArgs e)
        {

            //if (DataItem is Telerik.Web.UI.GridInsertionObject)
            //{
           btnFindOldExec.Attributes.Add("OnClick", "LinkMDdetail(" + HideOldPosExec.ClientID + "," + "'Forms/DialogRC_PosExec.aspx','../frmIframe.html',700,500)");
            //}






        }

        protected void btnFindOldExec_Click(object sender, ImageClickEventArgs e)
        {





            string st = HideOldPosExec.Value;
            if (st == "")
                return;
            BindOldExec(int.Parse(st)); 



        }


        private void BindOldExec(int id)
        {


            RC_TransferOfficialManageBLL obj = new RC_TransferOfficialManageBLL();

            DataTable dt;

            dt = obj.BindPosExec(id);

            if (dt.Rows.Count > 0)
            {

                lblOldPosExec.Text = dt.Rows[0]["exec_pos_seq"].ToString();
                txtOldExec.Text = dt.Rows[0]["exec_pos_name"].ToString();
            }




        }


        protected void txtOldExec_TextChanged(object sender, EventArgs e)
        {



        }

        protected void txtExec_TextChanged(object sender, EventArgs e)
        {



        }

        protected void btnFindExec_Click(object sender, ImageClickEventArgs e)
        {


            string st = HideExec.Value;
            if (st == "")
                return;


            BindExec(int.Parse(st));  



        }
        private void BindExec(int id)
        {

            RC_TransferOfficialManageBLL obj = new RC_TransferOfficialManageBLL();

            DataTable dt;

            dt = obj.BindPosExec(id);

            if (dt.Rows.Count > 0)
            {

                lblExec.Text = dt.Rows[0]["exec_pos_seq"].ToString();
                txtExec.Text = dt.Rows[0]["exec_pos_name"].ToString();
            }


        }

        protected void btnFindExec_Load(object sender, EventArgs e)
        {

            //if (DataItem is Telerik.Web.UI.GridInsertionObject)
            //{
            btnFindExec.Attributes.Add("OnClick", "LinkMDdetail(" + HideExec.ClientID + "," + "'Forms/DialogRC_PosExec.aspx','../frmIframe.html',700,500)");
            //}

        }

    
  

         


    }    
    
}